package net.begincode.common.page;

import java.io.Serializable;
import java.util.List;

/**
 * 分页响应类
 * */
public class PageResponse<T> implements Serializable {

    private static final long serialVersionUID = -6655714293857429697L;
    private int pageNum;
    private int pageSize = 10;
    private int totalSize;
    private List<T> data;

    public PageResponse() {
    }

    public PageResponse(int pageNum, int pageSize, int totalSize, List<T> data) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalSize = totalSize;
        this.data = data;
    }
    public static <T> PageResponse<T> success(List<T> data, int pageNum, int pageSize, int totalSize) {
        return new PageResponse<T>(pageNum, pageSize, totalSize, data);
    }

    public static <T> PageResponse<T> empty(int pageNum, int pageSize) {
        return new PageResponse<T>(pageNum, pageSize, 0, null);
    }
    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public int getTotalSize() {
        return totalSize;
    }

    public void setTotalSize(int totalSize) {
        this.totalSize = totalSize;
    }


}
